$(function(){
    var userName= decodeURIComponent(baseFunction.getUrlParameterValueByKey("userName"));
    userName?$("#userName").val(userName):"";
    var loginName=baseFunction.getval("loginName");
    var password=baseFunction.getval("password");
    $(".btn").on("click",function(){
        newUsername=$("#userName").val();
        $(".prompt").html("保存中...").show(0)
        var data={
            userName: baseFunction.encryption(loginName) ,
            queryType:"4412",
            arg1: baseFunction.encryption(newUsername+"###"),
        };
        baseFunction.netRequest("param",data,function(res){
            

            if(res.code==200){  //成功
                var data={
                    type: "1",
                    userName:baseFunction.encryption(loginName),
                    password:baseFunction.encryption(password),
                }
                baseFunction.netRequest("login",data,function(res){
                    
                    console.log(JSON.parse(JSON.parse(res.data).user));
                    
                    if(res.code==200){
                        window.localStorage.setItem("appUserInfo",res.data);
                        window.location.href="my_personalInfo.html";
                    }else{ //失败
                        $(".prompt").html(res.message).show(0).delay(2000).hide(0);
                    }
                })
                
            }
        })
    })

})